<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>module AboutYou::SDK::Model::BasketVariantItem - RDoc Documentation</title>

<link href="../../../fonts.css" rel="stylesheet">
<link href="../../../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
</script>

<script src="../../../js/jquery.js"></script>
<script src="../../../js/navigation.js"></script>
<script src="../../../js/search_index.js"></script>
<script src="../../../js/search.js"></script>
<script src="../../../js/searcher.js"></script>
<script src="../../../js/darkfish.js"></script>


<body id="top" role="document" class="module">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    
    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-new">::new</a>
    
    <li ><a href="#method-i-check_app_id">#check_app_id</a>
    
    <li ><a href="#method-i-check_variant_id">#check_variant_id</a>
    
    <li ><a href="#method-i-errors-3F">#errors?</a>
    
    <li ><a href="#method-i-old_price">#old_price</a>
    
    <li ><a href="#method-i-tax">#tax</a>
    
    <li ><a href="#method-i-total_net">#total_net</a>
    
    <li ><a href="#method-i-total_price">#total_price</a>
    
    <li ><a href="#method-i-total_vat">#total_vat</a>
    
    <li ><a href="#method-i-unique_key">#unique_key</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="module-AboutYou::SDK::Model::BasketVariantItem">
  <h1 id="module-AboutYou::SDK::Model::BasketVariantItem" class="module">
    module AboutYou::SDK::Model::BasketVariantItem
  </h1>

  <section class="description">
    
<p>BasketVairantItem is a class representing a basket variant item</p>

  </section>

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    
    <section class="attribute-method-details" class="method-section">
      <header>
        <h3>Attributes</h3>
      </header>

      
      <div id="attribute-i-app_id" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">app_id</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the app id of this variant item</p>
        
        </div>
      </div>
      
      <div id="attribute-i-json_object" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">json_object</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the json object from which this instance was created from</p>
        
        </div>
      </div>
      
      <div id="attribute-i-product" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">product</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the product of this variant item</p>
        
        </div>
      </div>
      
      <div id="attribute-i-variant" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">variant</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the variant of this variant item</p>
        
        </div>
      </div>
      
      <div id="attribute-i-variant_id" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">variant_id</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the variant id of this variant item</p>
        
        </div>
      </div>
      
    </section>
    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(variant_id, additional_data = nil, app_id = nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Constructor for the <a
href="BasketVariantItem.html">AboutYou::SDK::Model::BasketVariantItem</a>
class</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>variant_id</code> -&gt; the id of the variant item</p>
</li><li>
<p><code>additional_data</code> -&gt; additional data of the variant item</p>
</li><li>
<p><code>app_id</code> -&gt; the app id for the variant item</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="BasketVariantItem.html">AboutYou::SDK::Model::BasketVariantItem</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">variant_id</span>, <span class="ruby-identifier">additional_data</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">app_id</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">check_variant_id</span>(<span class="ruby-identifier">variant_id</span>)
  <span class="ruby-identifier">check_addition_data</span>(<span class="ruby-identifier">additional_data</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">variant_od</span> = <span class="ruby-identifier">variant_id</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">additional_data</span> = <span class="ruby-identifier">additional_data</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">self</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">app_id</span>

  <span class="ruby-identifier">check_app_id</span>(<span class="ruby-identifier">app_id</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">app_id</span> = <span class="ruby-identifier">app_id</span>

  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-check_app_id" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">check_app_id</span><span
            class="method-args">(app_id)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks if an app id is valid</p>
<ul><li>
<p><strong>Fails</strong> :</p>
<ul><li>
<p>if <a href="BasketVariantItem.html#attribute-i-app_id">#app_id</a> is not
an integer</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="check_app_id-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 150</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">check_app_id</span>(<span class="ruby-identifier">app_id</span>)
  <span class="ruby-identifier">fail</span> <span class="ruby-string">'\InvalidArgumentException! the app id must be
    an integer'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">app_id</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-check_variant_id" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">check_variant_id</span><span
            class="method-args">(variant_id)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks if a variant id is valid</p>
<ul><li>
<p><strong>Fails</strong> :</p>
<ul><li>
<p>if <a href="BasketVariantItem.html#attribute-i-variant_id">#variant_id</a>
is not an integer</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="check_variant_id-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 139</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">check_variant_id</span>(<span class="ruby-identifier">variant_id</span>)
  <span class="ruby-identifier">fail</span> <span class="ruby-string">'\InvalidArgumentException! the variant id must be
    an integer'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">variant_id</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-errors-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">errors?</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks if there are errors in the variant item</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Boolean determining whether there are errors or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="errors-3F-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 50</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">errors?</span>
  <span class="ruby-identifier">error_code</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-old_price" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">old_price</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Getter for the old price of the variant</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Integer containing the old price of the variant</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="old_price-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">old_price</span>
  <span class="ruby-identifier">variant</span>.<span class="ruby-identifier">old_price</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-tax" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">tax</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Getter for the tax</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Integer containing the tax</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="tax-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tax</span>
  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'tax'</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-total_net" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">total_net</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Getter for the total net</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Integer containing the total net</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="total_net-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 90</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_net</span>
  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'total_net'</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-total_price" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">total_price</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Getter for the total price</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Integer containing the total price</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="total_price-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_price</span>
  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'total_price'</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-total_vat" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">total_vat</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Getter for the total vat</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Integer containing the total vat</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="total_vat-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 80</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_vat</span>
  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'total_vat'</span>]
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-unique_key" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">unique_key</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for creating a unique key for the basket set</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a String containing a unique key for the basket set</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="unique_key-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/Basket/basket_variant_item.rb, line 123</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unique_key</span>
  <span class="ruby-identifier">key</span> = <span class="ruby-identifier">variant_id</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">additionalData</span>
    <span class="ruby-identifier">additionalData</span>.<span class="ruby-identifier">sort!</span>
    <span class="ruby-identifier">key</span> <span class="ruby-operator">+=</span> <span class="ruby-string">':'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">additionalData</span>.<span class="ruby-identifier">to_json</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">key</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>

